package Core;

import java.util.Vector;

public class ImagePool 
{
	public Vector images = new Vector();
	
	public Img CreateImage(String path, int w, int h, int bg, boolean ispanel)
	{
		Img img;
		//System.out.println("Create image started...");
		for(int i=0; i<images.size(); i++)
		{
			img = (Img) images.elementAt(i);
			//System.out.println("Compare ["+path+" "+img.name+"] ["+w+" "+img.getW()+"] ["+h+" "+img.getH()+"] ["+bg+" "+img.bg+"] ["+ispanel+" "+img.ispanel+"]");
			if(path.equals(img.name) && w==img.getW() && h==img.getH() && bg==img.bg && ispanel==img.ispanel)
			{
				//System.out.println("Find existing image");
				return img;
			}
		}
		
		img = new Img(path, w, h, bg, ispanel);
		images.addElement(img);
		//System.out.println("Create new image");
		return img;
	}
}
